package fact.view.util;


import java.util.Calendar;
import java.util.GregorianCalendar;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.SelectItem;

@ManagedBean(name = "selectBoxBean")
@SessionScoped
public class SelectboxBean {

	 private SelectItem[] monthList;
	 private SelectItem[] yearList;

	// BackingBean Contructor
	 public SelectboxBean () {
		 monthList = new SelectItem[12];
		 monthList[0] = new SelectItem("1", "January");
		 monthList[1] = new SelectItem("2", "February");
		 monthList[2] = new SelectItem("3", "March");
		 monthList[3] = new SelectItem("4", "April");
		 monthList[4] = new SelectItem("5", "May");
		 monthList[5] = new SelectItem("6", "June");
		 monthList[6] = new SelectItem("7", "July");
		 monthList[7] = new SelectItem("8", "August");
		 monthList[8] = new SelectItem("9", "September");
		 monthList[9] = new SelectItem("10", "October");
		 monthList[10] = new SelectItem("11", "November");
		 monthList[11] = new SelectItem("12", "December");

		 GregorianCalendar gc = new GregorianCalendar();
		 int year = gc.get(Calendar.YEAR);
		 
		 
		 yearList = new SelectItem[6];
		 int count=0;
		 for(int i=year;i>=year-5;i--)
		 {
			 yearList[count] = new SelectItem(String.valueOf(i), String.valueOf(i));
			 count++;
		 }
	 }

	public SelectItem[] getMonthList() {
		return monthList;
	}

	public void setMonthList(SelectItem[] monthList) {
		this.monthList = monthList;
	}

	public SelectItem[] getYearList() {
		return yearList;
	}

	public void setYearList(SelectItem[] yearList) {
		this.yearList = yearList;
	}
	 
	 

}